package com.mmy.dao.car;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.mmy.domain.car.VCarBase;

public interface VCarBaseRepository extends JpaRepository<VCarBase, Integer> {

	/*
	 * 根据name查找
	 */
	@Query(value = "select *  from vCarBase where (:strTypeName = \"\" or cTypeName = :strTypeName) and (:strOrgName = \"\" or cOrgName = :strOrgName)", nativeQuery = true)
	List<VCarBase> findByName(@Param("strTypeName") String strTypeName, @Param("strOrgName") String strOrgName);

	/*
	 * 根据id查找
	 */
	@Query(value = "select *  from vCarBase where iCarID = :iCarID", nativeQuery = true)
	VCarBase findByCarID(@Param("iCarID") int iCarID);

}
